<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>更新学生</title>
    <!-- 可选的样式表链接 -->
    <link rel="stylesheet" type="text/css" href="/css/styles.css" />
</head>
<body>
<h2>更新学生</h2>
<form th:action="@{/student/updateStudent}" th:object="${student}" method="post">
    <!-- 课程号，由模型传递并预填充 -->
    <div>
        <label for="sno">学号</label>
        <input type="text" id="sno" th:field="*{sno}" th:readonly="true" required />
        <!-- 假设 Student 类的属性名为 id，且为不可修改 -->
        <span th:if="${#fields.hasErrors('sno')}" th:errors="*{sno}"></span>
    </div>

    <!-- 课程名称 -->
    <div>
        <label for="sname">姓名</label>
        <input type="text" id="sname" th:field="*{sname}" required />
        <span th:if="${#fields.hasErrors('sname')}" th:errors="*{sname}"></span>
    </div>

    <!-- 课程时间 -->
    <div>
        <label for="sage">年龄</label>
        <input type="number" id="sage" th:field="*{sage}" />
        <!-- 假设 Student 类的属性名为 hours -->
        <span th:if="${#fields.hasErrors('sage')}" th:errors="*{sage}"></span>
    </div>
    <div>
        <label for="ssex">性别</label>
        <input type="text" id="ssex" th:field="*{ssex}" required />
        <span th:if="${#fields.hasErrors('ssex')}" th:errors="*{ssex}"></span>
    </div>
    <div>
        <label for="sdept">系</label>
        <input type="text" id="sdept" th:field="*{sdept}" required />
        <span th:if="${#fields.hasErrors('sdept')}" th:errors="*{sdept}"></span>
    </div>

    <!-- 提交按钮 -->
    <div>
        <button type="submit">提交</button>
    </div>
</form>
</body>
</html>